import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class h_3 {
    public static void main(String[] args) {
        Map<Character,Integer> map=new HashMap<>();
        Scanner sc=new Scanner(System.in);
        String y=sc.next();
        int x=sc.nextInt();

        char [] chararray=y.toCharArray();
        int num=chararray.length;

        for (char c : chararray) {
            if(map.containsKey(c)) {
                Integer value=map.get(c);
                value++;
                map.put(c, value);

            }else{
                map.put(c, 1);
            }
        }
        for(Map.Entry<Character, Integer> e:map.entrySet()){
            if(e.getValue()==x){
                System.out.println(e.getKey());
            }
        }
    }
}
